package com.edu.mapper;

import com.edu.bean.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StuMapper {
    /*查询一个学生*/
    @Select("select * from student where stuId=#{stuId}")
    Student selectStuById(int stuId);

    /*查询所有学生*/
    @Select("select * from student")
    List<Student> selectStu();

    /*添加学生*/
    @Insert("insert into student(stuName,stuAge) values(#{stuName},#{stuAge})")
    int insertStu(Student stu);

    /*删除学生*/
    @Delete("delete from student where stuId=#{stuId}")
    int deleteStu(int stuId);

    /*修改学生信息*/
    @Update("update student set stuAge=${stuAge} where stuId=#{stuId}")
    int updateStu(Student stu);
}
